package export.monster
{
    import com.game.manager.AnimationManager;
    import base.BaseMonster;
    
    import export.bullet.FollowTargetBullet;
    
    import flash.geom.Rectangle;
    
    public class Monster105 extends BaseMonster
    {
        public function Monster105()
        {
            super();
        }
        
        override protected function initAttribute():void
        {
            super.initAttribute();
            mavo.attackRange = 300;
            mavo.normalAttackRate = 45;
        }
        
        override protected function initBBDC():void
        {
            bbdc = AnimationManager.getAnimation("Monster105Action");
            bbdc.setAction("idle");
            bbdc.turnRight();
            bbdc.addCallBack(onEnterFrame, onActionOver);
            bodyContainer.addChild(bbdc);
        }
        
        override protected function initCollideArea():void
        {
            collideBox = new Rectangle(-20, -80, 40, 80);
            super.initCollideArea();
        }
        
        override protected function onEnterFrame(action:String, frameCount:int):void
        {
            var b:FollowTargetBullet;
            switch (action)
            {
                case "attack1":
                    if (frameCount == 3)
                    {
                        b = new FollowTargetBullet("Monster105Attack1");
                        b.setOwner(this);
                        b.setHurt(getActionHurt("attack1"));
                        b.setAction("Monster105Attack1");
                        b.setClipOffset(20,-130);
                    }
                    break;
                case "skill1":
                    if(frameCount == 1)
                    {
                        setSteelBody(bbdc.frameLeft);
                        b = new FollowTargetBullet("Monster105Skill1_1");
                        b.setOwner(this);
                        b.setDisable();
                        b.setClipOffset(-37,-90);
                    }
                    if(frameCount == 21)
                    {
                        b = new FollowTargetBullet("Monster105Skill1_2");
                        b.setOwner(this);
                        b.setHurt(getActionHurt("skill1"));
                        b.setAction("Monster105Skill1");
                        b.setClipOffset(-601.6,-579.1);
                        b.setScale(0.7,0.7);
                    }
            }
            if(b)
            {
                gc.gameScene.addChild(b);
                magicBulletArray.push(b);
            }
        }
        
        override protected function beforeSkill1Start():Boolean
        {
            return this.hasTarget() && AUtils.GetDisBetweenTwoObj(this, this.curAttackTarget) < 400;
        }
        
        override public function getActionHurt(action:String):int
        {
            var ratio:Number = 1;
            if(action == "skill1")
            {
                ratio = 1.6;
            }
            return super.getActionHurt(action) * ratio;
        }
    }
}